<?php
/**
 * 首页微博分享推荐
 * 
 * @copyright dongping
 * @since 2012-04-09
 */

/* 引入相关文件 */
include_once($_SERVER["DOCUMENT_ROOT"]. "/core/inc.php");
include_once($_SERVER["DOCUMENT_ROOT"]. "/config/inc.php");
include_once($_SERVER["DOCUMENT_ROOT"] . "/core/admin.inc.php");
include_once($_SERVER["DOCUMENT_ROOT"]. "/include/foodv2/inc.php");

// 所有的参数
$g_cgival = array();
// 存储中间数据 非输出数据 可以不用
$g_pro    = array();
// 要显示的数据 输出数据
$g_show   = array();


function check_cgi_pro()
{
	global $g_cgival, $g_pro, $g_show;
}

function get_data()
{
	global $g_cgival, $g_pro, $g_show;
	
	// 拿到当前站点的site_id
	$site_id = admin::admin_get_user_site_id();
	$admin_id = admin::admin_get_login_uid();
	$admin_name = admin::admin_get_login_user_name();
	
	
	$db = new db_food_index_share_tj();
	$db->debug = true;
	$data = $db->get_share_list($site_id);
	
	if (is_array($data) and count($data) > 0)
	{
		$g_show["data"] = $data;
		$g_show["count"] = count($data);
	}
	else
	{
		$g_show["data_none"] = "1";
	}
	
	return ;
}

try
{
	admin_check_login();
// 	admin_check_user_priv("foodv2/main_nav.php");
	
	check_cgi_pro();
	get_data();
}
catch(Exception $e)
{
	$g_show["error"] = 1;
	$g_show["errmsg"] = $e->getMessage();
}

show_pro();
exit;


function show_pro()
{
	global $g_show;
	$smarty = p_get_smarty ();
	$smarty->assign ( 'g_show', $g_show );
	
	if (isset($_GET["debug"]))
	{
		echo "<pre>";
		print_r($g_show);
	}
	$smarty->display ( "foodv2/index/share.html" );
}

?>